package com.eastfair.imaster.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.eastfair.imaster.dao.CustomerPoolLogsMapper;
import com.eastfair.imaster.entity.CustomerPoolLogs;
import com.eastfair.imaster.service.CustomerPoolLogsService;
import com.eastfair.boot.service.SuperServiceImpl;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.eastfair.constant.BusinessConstant;
import com.eastfair.core.base.R;

import java.util.Collection;

/**
 * <p>
 * 业务实现类
 * 客户池操作记录表
 * </p>
 *
 * @author liuxiaobai
 * @date 2021-11-15
 */
@Slf4j
@Service
@DS("#thread.tenant")
public class CustomerPoolLogsServiceImpl extends SuperServiceImpl<CustomerPoolLogsMapper, CustomerPoolLogs> implements CustomerPoolLogsService {


    /**************sharding 分库分表操作 *****************/
    @Override
    public boolean updateByIdOfShard(CustomerPoolLogs entity) {
        UpdateWrapper<CustomerPoolLogs> updateWrapper = new UpdateWrapper<>();
        //可将指定字段更新为null
        updateWrapper.lambda().eq(CustomerPoolLogs::getProjectId, entity.getProjectId()).eq(CustomerPoolLogs::getId, entity.getId());
        entity.setProjectId(null);
        return SqlHelper.retBool(this.getBaseMapper().update(entity, updateWrapper));
    }


}
